ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Vole_Male Class Reference

The class for male voles. More...

#include <vole_all.h>

Inheritance diagram for Vole_Male:
Vole_JuvenileMale Vole_Base TAnimal TALMaSSObject

Public Member Functions

 Vole_Male (struct_Vole_Adult *p_aVoleStruct)
 Vole_Male constructor. More...
 
virtual void ReInit (struct_Vole_Adult *p_aVoleStruct)
 
virtual ~Vole_Male ()
 
virtual void Step ()
 Male vole Step. More...
 
virtual void EndStep ()
 Male vole EndStep. More...
 
- Public Member Functions inherited from Vole_JuvenileMale
 Vole_JuvenileMale (struct_Vole_Adult *p_aVoleStruct)
 Vole_JuvenileMale constructor. More...
 
virtual ~Vole_JuvenileMale ()
 
virtual bool OnFarmEvent (FarmToDo event)
 JuvenileMale vole exernal event handler. More...
 
virtual void BeginStep ()
 Juvenile Male vole BeginStep. More...
 
virtual void OnKilled ()
 JuvenileMale vole death by external entity. More...
 
- Public Member Functions inherited from Vole_Base
 Vole_Base (struct_Vole_Adult *p_aVoleStruct)
 Constructor for Vole_Base. More...
 
virtual ~Vole_Base ()
 
virtual void Init (struct_Vole_Adult *p_aVoleStruct)
 
void st_Dying ()
 All voles end here on death. More...
 
void SetBreedingSeason (bool a_flag)
 Set Breeding Season flag. More...
 
void SetWeight (double W)
 
void Setm_Mature ()
 
void Set_BirthYear (int BirthYear)
 
void Set_MotherId (unsigned MotherIdNo)
 
void Set_FatherId (unsigned FatherIdNo)
 
void Set_NoYoungTot (int a_NoOfYoung)
 
void Set_XBorn (int a_Location_x)
 
void Set_YBorn (int a_Location_y)
 
void Set_ElemBorn (int a_Location_x, int a_Location_y)
 
void Set_VegBorn (int a_Location_x, int a_Location_y)
 
void Set_PolyRefBorn (int a_Location_x, int a_Location_y)
 
void Set_Age (int Age)
 
virtual int WhatState ()
 
bool SupplyBornLastYear ()
 Were we born this year? More...
 
bool SupplyTerritorial ()
 
int SupplyFatherId ()
 
int SupplyMotherId ()
 
bool SupplySex ()
 
int SupplyBirthYear ()
 
int SupplyTotNoYoung ()
 
int SupplyXBorn ()
 
int SupplyYBorn ()
 
int SupplyPolyRefBorn ()
 
int SupplyElemBorn ()
 
TTypesOfLandscapeElement SupplyElemType ()
 
int SupplyVegBorn ()
 
int SupplyTerrRange ()
 
double SupplyWeight ()
 
int SupplyIDNo ()
 
bool SupplyMature ()
 
int SupplyDeathCause ()
 
unsigned SupplyAge ()
 
unsigned SupplyX ()
 
unsigned SupplyY ()
 
bool SupplyInTrap ()
 
InTrapPosition SupplyTrapPosition ()
 
void SetFree ()
 
int SupplyHomoZyg ()
 
int SupplyHeteroZyg ()
 
int SupplyAllele (int locus, int allele)
 
uint32 SupplyMyAllele (int i, int j)
 
int GetGeneticFlag ()
 
int GetDirectFlag ()
 
void SetGeneticFlag ()
 
void SetDirectFlag ()
 
void UnsetGeneticFlag ()
 
void UnsetDirectFlag ()
 
GeneticMaterial SupplyGenes ()
 
void CopyMyself (VoleObject a_vole)
 Duplicates a vole. More...
 
void SetFertile (bool f)
 Set the male vole fertility. More...
 
bool GetFertile ()
 Get the male vole fertility. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

VoleDispersalReturns Dispersal (double p_OldQual, int p_Distance)
 Male vole dispersal behaviour. More...
 
void DetermineTerritorySize ()
 Calculates the territory size needed for a vole of his weight. More...
 
bool CanFeed ()
 Currently not used. More...
 
int st_Maturation (void)
 Male vole maturation control. More...
 
void st_Infanticide (void)
 Male vole infanticide behaviour. More...
 
virtual bool MortalityTest ()
 Do a mortality test. More...
 
TTypeOfVoleState st_Eval_n_Explore (void)
 Male vole main territory assessment behaviour. More...
 
- Protected Member Functions inherited from Vole_JuvenileMale
virtual void SetLocation ()
 Map location function. More...
 
virtual void FreeLocation ()
 Map location function. More...
 
virtual bool GetLocation (int px, int py)
 Map location function. More...
 
TTypeOfVoleState Dispersal (double p_OldQual, int p_Distance)
 JuvenileMale vole dispersal behaviour. More...
 
void DetermineTerritorySize ()
 
bool CanFeed ()
 
void st_JuvenileExplore (void)
 Extra movement on weaning. More...
 
void st_BecomeSubAdult (void)
 
TTypeOfVoleState st_Eval_n_Explore (void)
 JuvenileMale vole main territory assessment behaviour. More...
 
- Protected Member Functions inherited from Vole_Base
virtual void RodenticideIngestion (void)
 
double CalculateCarryingCapacity (int x, int y, int a_ddep)
 
int MoveQuality (int p_x, int p_y)
 Test a location for quality while moving. More...
 
void MoveTo (int p_Vector, int p_Distance, int iterations)
 Movement. More...
 
void DoWalking (int p_Distance, int &p_Vector, int &vx, int &vy)
 Walking. More...
 
void DoWalkingCorrect (int p_Distance, int &p_Vector, int &vx, int &vy)
 Walking where there is a danger of stepping off the world. More...
 
void Escape (int p_Vector, int p_Distance)
 Dispersal - directed movement. More...
 
void CheckTraps ()
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Additional Inherited Members

- Public Attributes inherited from Vole_Base
TTypeOfVoleState CurrentVState
 
Vole_Population_Managerm_OurPopulation
 
- Protected Attributes inherited from Vole_Base
int m_BirthYear
 
bool m_BornLastYear
 A flag set if the female was born the year before. More...
 
unsigned int m_MinTerrRange
 
unsigned m_MotherId
 
unsigned m_FatherId
 
int m_Death
 
int m_TerrRange
 
bool m_Sex
 
bool m_Mature
 
int m_Age
 
int m_XBorn
 
int m_YBorn
 
int m_PolyRefBorn
 
int m_ElemBorn
 
int m_VegBorn
 
int m_LifeSpan
 
double m_Weight
 
bool m_fertile
 Flag indicating the fertility state (true means fertile)
More...
 
int m_NoOfYoungTotal
 
int m_DispVector
 
bool m_Have_Territory
 
int m_Reserves
 
unsigned IDNo
 
int SimH
 
int SimW
 
GeneticMaterial m_MyGenes
 
InTrapPosition m_intrappos
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 
- Static Protected Attributes inherited from Vole_Base
static unsigned int m_MaxMaleTerritorySize = 0
 
static unsigned int m_MaxFemaleTerritorySize = 0
 
static unsigned int m_MinMaleTerritorySize = 0
 
static unsigned int m_MinFemaleTerritorySize = 0
 
static double m_MinFVoleHabQual = 0
 
static double m_MinJMVoleHabQual = 0
 
static double m_MinMVoleHabQual = 0
 
static double m_MaleTerritoryRangeSlope = 0
 
static double m_FemaleTerritoryRangeSlope = 0
 
static double m_FHabQualThreshold3
 
static double m_FHabQualThreshold2
 
static double m_FHabQualThreshold1
 
static double m_MHabQualThreshold3
 
static double m_MHabQualThreshold2
 
static double m_MHabQualThreshold1
 
static bool m_BreedingSeason = false
 

Detailed Description

The class for male voles.

Contains all the behaviour specific to the male vole. Only st_Infanticide and st_JuvenileExplore are specific to the male, other behaviours differ only in details from the female.

Constructor & Destructor Documentation

◆ Vole_Male()

Vole_Male::Vole_Male ( struct_Vole_Adult p_aVoleStruct)

Vole_Male constructor.

2413  :Vole_JuvenileMale(p_aVoleStruct)
2414 {
2415  m_Age = p_aVoleStruct->age;
2416  m_Weight = p_aVoleStruct->weight;
2417  m_BirthYear = p_aVoleStruct->BirthYear;
2418  m_Sex = true;
2421 }
bool m_Sex
Definition: vole_all.h:174
int m_BirthYear
Definition: vole_all.h:157
double m_Weight
Definition: vole_all.h:192
unsigned int m_MinTerrRange
Definition: vole_all.h:164
int m_Age
Definition: vole_all.h:178
int m_TerrRange
Definition: vole_all.h:172
static unsigned int m_MinMaleTerritorySize
Definition: vole_all.h:220
Vole_JuvenileMale(struct_Vole_Adult *p_aVoleStruct)
Vole_JuvenileMale constructor.
Definition: Vole_all.cpp:3313
int age
Definition: vole_all.h:127
double weight
Definition: vole_all.h:128
int BirthYear
Definition: vole_all.h:134

References struct_Vole_Adult::age, struct_Vole_Adult::BirthYear, Vole_Base::m_Age, Vole_Base::m_BirthYear, Vole_Base::m_MinMaleTerritorySize, Vole_Base::m_MinTerrRange, Vole_Base::m_Sex, Vole_Base::m_TerrRange, Vole_Base::m_Weight, and struct_Vole_Adult::weight.

◆ ~Vole_Male()

Vole_Male::~Vole_Male ( )
virtual
2436 {
2437  // Nothing to do
2438 }

Member Function Documentation

◆ CanFeed()

bool Vole_Male::CanFeed ( )
inlineprotected

Currently not used.

Check whether our location is of sufficient quality to allow use to feed, ie. is it over or under min suitable quality (m_MinMVoleHabQual).

2794 {
2796  else return false;
2797 }
CfgInt cfg_VoleDDepConst("VOLE_DDEPCONST", CFG_CUSTOM, 4)
int value(void)
Definition: configurator.h:98
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
double CalculateCarryingCapacity(int x, int y, int a_ddep)
Definition: Vole_all.cpp:384
static double m_MinMVoleHabQual
Definition: vole_all.h:228

References Vole_Base::CalculateCarryingCapacity(), cfg_VoleDDepConst, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_MinMVoleHabQual, and CfgInt::value().

◆ DetermineTerritorySize()

void Vole_Male::DetermineTerritorySize ( )
inlineprotected

Calculates the territory size needed for a vole of his weight.

2779 {
2780  if (m_Weight < MinReproWeightM) return;
2782 }
const unsigned MinReproWeightM
Definition: Vole_all.cpp:149
static double m_MaleTerritoryRangeSlope
Definition: vole_all.h:230

References Vole_Base::m_MaleTerritoryRangeSlope, Vole_Base::m_MinMaleTerritorySize, Vole_Base::m_TerrRange, Vole_Base::m_Weight, and MinReproWeightM.

Referenced by EndStep().

◆ Dispersal()

VoleDispersalReturns Vole_Male::Dispersal ( double  p_OldQual,
int  p_Distance 
)
protected

Male vole dispersal behaviour.

Works like female dispersal - but a return code of 3 will trigger infanticide
Checks p_Distance away to see if it can find a territory in the next MHabQualThreshold category or with
an improved quality of 1.1* p_OldQual if already in optimal habitat
This entails some risk though, so there is a fixed increase in the mortality chance when it does this.

2690 {
2691 
2692  // int retval = 0;
2693  // p_OldQuatells whether dispersal is conditional on quality or not
2694  // p_OldQual is set to old habitat quality or -1
2695  // p_Distance is the p_Distance used by the move function
2696  // aim is to move in a directed way traversing the landscape using the best
2697  // habitats
2698  // remember the old co-ordinates in case infanticide needs to be triggered
2699  int oldx = m_Location_x;
2700  int oldy = m_Location_y;
2701 #ifdef __VOLE_SMALL_LANDSCAPE
2702  m_DispVector = random(8); // Choose direction 0-7
2703 #else
2704  if (m_DispVector == -1) m_DispVector = random(8); // Choose direction 0-7
2705 #endif
2706  // Go that far in that direction (assuming it is possible to do that)
2707  MoveTo(m_DispVector, p_Distance, 10);
2708  // Now we are there so what is the new quality
2709  // 1. Get the carrying capacity
2710  int OldMales = 1;
2711  int NoFemales = 1;
2712  if (m_BreedingSeason)
2713  {
2715  NoFemales = OldMales; // If can be 0 or >0 if OldMales does not return 1
2716  }
2718  if (p_OldQual == -1)
2719  {
2720  // Do an extra mortality test if we are forced to disperse
2721  if (g_rand_uni() < g_extradispmort)
2722  {
2724  return vdisp_Die;
2725  }
2726  }
2727 
2728  if ((CC < p_OldQual) || (OldMales < 1) || (NoFemales < 1))
2729  {
2730  // Don't want to move
2731  FreeLocation();
2732  m_Location_x = oldx;
2733  m_Location_y = oldy;
2734  SetLocation();
2735  return vdisp_CarryOn;
2736  }
2737  else if (CC > m_MinMVoleHabQual)
2738  {
2739  m_Have_Territory = true;
2740  if (m_BreedingSeason)
2741  {
2742  if (!m_Mature)
2743  {
2744  return vdisp_Mature; // Will also trigger infanticde
2745  }
2746  if ((abs(oldx - m_Location_x) > (2 * m_TerrRange)) || (abs(oldy - m_Location_y) > (2 * m_TerrRange)))
2747  {
2748  // Have we moved more than _TerrRange from old home
2749  return vdisp_Infanticide; // This will result in an infanticide attempt if females in the new territory have young and the male has moved outside his old terr range.
2750  }
2751  }
2752  }
2753  return vdisp_CarryOn;
2754 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
CfgBool cfg_RecordVoleMort
double g_extradispmort
Definition: Vole_all.cpp:204
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
@ tovmort_MDisp
Definition: VolePopulationManager.h:79
bool value(void)
Definition: configurator.h:135
static bool m_BreedingSeason
Definition: vole_all.h:247
bool m_Mature
Definition: vole_all.h:176
int m_DispVector
Definition: vole_all.h:202
void MoveTo(int p_Vector, int p_Distance, int iterations)
Movement.
Definition: Vole_all.cpp:907
Vole_Population_Manager * m_OurPopulation
Definition: vole_all.h:408
bool m_Have_Territory
Definition: vole_all.h:204
virtual void FreeLocation()
Map location function.
Definition: Vole_all.cpp:3085
virtual void SetLocation()
Map location function.
Definition: Vole_all.cpp:3076
int SupplyInOlderTerr(unsigned p_x, unsigned p_y, unsigned p_Age, unsigned p_Range)
Definition: VolePopulationManager.cpp:3043
VoleSummaryOutput * m_VoleRecordMort
Definition: VolePopulationManager.h:197
void ChangeData(int a_data, int a_value)
Definition: VolePopulationManager.cpp:4048
@ vdisp_Die
Definition: vole_all.h:80
@ vdisp_CarryOn
Definition: vole_all.h:79
@ vdisp_Mature
Definition: vole_all.h:81
@ vdisp_Infanticide
Definition: vole_all.h:82

References Vole_Base::CalculateCarryingCapacity(), cfg_RecordVoleMort, cfg_VoleDDepConst, VoleSummaryOutput::ChangeData(), Vole_JuvenileMale::FreeLocation(), g_extradispmort, g_rand_uni, Vole_Base::m_Age, Vole_Base::m_BreedingSeason, Vole_Base::m_DispVector, Vole_Base::m_Have_Territory, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_Mature, Vole_Base::m_MinMVoleHabQual, Vole_Base::m_OurPopulation, Vole_Base::m_TerrRange, Vole_Population_Manager::m_VoleRecordMort, Vole_Base::MoveTo(), random(), Vole_JuvenileMale::SetLocation(), Vole_Population_Manager::SupplyInOlderTerr(), tovmort_MDisp, CfgInt::value(), CfgBool::value(), vdisp_CarryOn, vdisp_Die, vdisp_Infanticide, and vdisp_Mature.

Referenced by st_Eval_n_Explore().

◆ EndStep()

void Vole_Male::EndStep ( void  )
virtual

Male vole EndStep.

The EndStep is one of the three timestep divisions. This is called once for each vole after BeginStep and Step.
The main function here is to remove voles that have died during step and otherwise to grow if not at max weight. It also checks if the vole was killed due to human management and determines the potential territory size.

Reimplemented from Vole_JuvenileMale.

2491 {
2492 #ifdef __VoleStarvationDays
2493  if (m_Have_Territory) m_StarvationDays = 0;
2494  if ( m_StarvationDays > m_MaxStarvationDays)
2495  {
2496  st_Dying();
2498  }
2499  else
2500 #endif
2501  {
2502  CheckManagement();
2504  {
2505  st_Dying();
2506  }
2507  else
2508  {
2509  m_Age++;
2510  /* MALE GROWTH NOTES
2511 
2512  Male vole grows until 20g. After that he will only grow if he has matured
2513  Growth continues up to 60g.
2514 
2515  Reproduction cannot occur below 40g or 40 days
2516 
2517  Growth only occurs between 1 March and 1st August
2518  taken from Hanson L, 1977, Oikos 29.
2519  */
2520  int today = m_OurLandscape->SupplyDayInYear();
2521  if ((today < GrowStopDate) && (today > m_OurPopulation->SupplyGrowthStartDate()))
2522  {
2523  if (m_Weight<20)
2524  {
2526  }
2527  else if ((m_Mature==true) && (m_Weight<MaxWeightM))
2528  {
2530  }
2531  }
2532  else if ((today == 1)) {
2533  m_BornLastYear = true;
2534  m_Mature = true;
2535  }// must be true if alive on 1st Jan.
2537  }
2538  }
2539 }
const int GrowStopDate
Definition: Vole_all.cpp:143
const double MaxWeightM
Definition: Vole_all.cpp:133
const double growthperdayM
Definition: Vole_all.cpp:139
@ tovmort_MStarve
Definition: VolePopulationManager.h:73
int SupplyDayInYear(void)
Definition: landscape.h:1596
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
void CheckManagement(void)
Definition: PopulationManager.cpp:1404
void st_Dying()
All voles end here on death.
Definition: Vole_all.cpp:348
bool m_BornLastYear
A flag set if the female was born the year before.
Definition: vole_all.h:162
TTypeOfVoleState CurrentVState
Definition: vole_all.h:407
void DetermineTerritorySize()
Calculates the territory size needed for a vole of his weight.
Definition: Vole_all.cpp:2778
int SupplyGrowthStartDate()
Definition: VolePopulationManager.h:237
@ tovs_MDying
Definition: vole_all.h:63

References cfg_RecordVoleMort, VoleSummaryOutput::ChangeData(), TAnimal::CheckManagement(), Vole_Base::CurrentVState, DetermineTerritorySize(), GrowStopDate, growthperdayM, Vole_Base::m_Age, Vole_Base::m_BornLastYear, Vole_Base::m_Have_Territory, Vole_Base::m_Mature, TAnimal::m_OurLandscape, Vole_Base::m_OurPopulation, Vole_Population_Manager::m_VoleRecordMort, Vole_Base::m_Weight, MaxWeightM, Vole_Base::st_Dying(), Landscape::SupplyDayInYear(), Vole_Population_Manager::SupplyGrowthStartDate(), tovmort_MStarve, tovs_MDying, and CfgBool::value().

◆ MortalityTest()

bool Vole_Male::MortalityTest ( )
protectedvirtual

Do a mortality test.

Takes both physiological lifespan and background mortality into account to determine whether the vole should die - repeated calls increase the risk of dying

Reimplemented from Vole_Base.

2764 {
2765  // returns true if the vole should die
2766  if ( m_Have_Territory )
2767  {
2768  if (g_rand_uni() < g_DailyMortChanceMaleTerr) return true;
2769  }
2770  else if (g_rand_uni() < g_DailyMortChance) return true;
2771  return false;
2772 }
double g_DailyMortChanceMaleTerr
Definition: Vole_all.cpp:190
double g_DailyMortChance
Definition: Vole_all.cpp:189

References g_DailyMortChance, g_DailyMortChanceMaleTerr, g_rand_uni, and Vole_Base::m_Have_Territory.

◆ ReInit()

void Vole_Male::ReInit ( struct_Vole_Adult p_aVoleStruct)
virtual

Reimplemented from Vole_JuvenileMale.

2424  {
2425  Init(p_aVoleStruct);
2426  m_Age = p_aVoleStruct->age;
2427  m_Weight = p_aVoleStruct->weight;
2428  m_BirthYear = p_aVoleStruct->BirthYear;
2429  m_Sex = true;
2432 }
virtual void Init(struct_Vole_Adult *p_aVoleStruct)
Definition: Vole_all.cpp:240

References struct_Vole_Adult::age, struct_Vole_Adult::BirthYear, Vole_Base::Init(), Vole_Base::m_Age, Vole_Base::m_BirthYear, Vole_Base::m_MinMaleTerritorySize, Vole_Base::m_MinTerrRange, Vole_Base::m_Sex, Vole_Base::m_TerrRange, Vole_Base::m_Weight, and struct_Vole_Adult::weight.

◆ st_Eval_n_Explore()

TTypeOfVoleState Vole_Male::st_Eval_n_Explore ( void  )
protected

Male vole main territory assessment behaviour.

Evaluates the quality of his habitat and does some limited exploration in the surrounding area to see if she can improve it by moving.

2585 {
2587 
2588  unsigned MovementIndex;
2589  if (m_Age>90) MovementIndex=3;
2590  else if (m_Age>60) MovementIndex=2;
2591  else if (m_Age>30) MovementIndex=1;
2592  else MovementIndex=0;
2593  int OldMales = m_OurPopulation->SupplyInOlderTerr(m_Location_x,m_Location_y,m_Age,m_TerrRange); // returns -1 if a male has p_x,p_y in his territory and is older than p_Age else returns the number of females present
2594  int NoFemales = OldMales;
2595  double Qual = CalculateCarryingCapacity(m_Location_x, m_Location_y,10000);
2596  //if (OldMales>1) Qual/=OldMales; // Share resources with the females, but no-one else
2597  if ( m_BreedingSeason )
2598  {
2599  if( m_Have_Territory ) // Must be mature
2600  {
2601  #ifdef __USINGTRAPLINES
2602  CheckTraps();
2603  #endif
2604  if (!m_Mature)
2605  {
2606  return tovs_MMaturation; // Special case, immature male in breeding season with territory will mature
2607  }
2608  // If he his mature then he must move if in an older males territory
2609  bool NoMates = false;
2610  if (NoFemales<1)
2611  {
2612  if ((g_rand_uni() < g_NoFemalesMove))
2613  {
2615  if (af!=NULL)
2616  {
2617  AnimalPosition ap = af->SupplyPosition();
2618  int tx=(SimW+ap.m_x+(random(2)-1))%SimW;
2619  int ty=(SimH+ap.m_y+(random(2)-1))%SimH;
2620  while ((GetLocation(tx,ty)) && (MoveQuality(tx,ty)<1))
2621  {
2622  tx=(SimW+tx+(random(2)-1))%SimW;
2623  ty=(SimH+ty+(random(2)-1))%SimH;
2624  }
2625  FreeLocation();
2626  m_Location_x=tx;
2627  m_Location_y=ty;
2628  SetLocation();
2629  } else NoMates = true;
2630  }
2631  } else
2632  if (((OldMales<1)|| (Qual<m_MinFVoleHabQual) || (NoMates)) && !m_BornLastYear) // In larger males territory, must move or are no females
2633  {
2634  m_Have_Territory = false;
2635  m_DispVector = random(8);
2636  retval = (Dispersal(Qual,MaleMovement[MovementIndex]));
2637  }
2638  }
2639  else
2640  {
2641  // No territory & Breeding season
2642  #ifdef __USINGTRAPLINES
2643  CheckTraps();
2644  #endif
2645  // Not quality dependent dispersal, very directed
2646  retval = (Dispersal(-1, MaleMovement[MovementIndex]));
2647  }
2648  }
2649  else // Not breeding season
2650  {
2651  #ifdef __USINGTRAPLINES
2652  CheckTraps();
2653  #endif
2654  if ( (OldMales<1) || (Qual < m_MinFVoleHabQual ))
2655  {
2656  #ifdef __VoleStarvationDays
2657  m_StarvationDays++;
2658  #endif
2659  retval = (Dispersal(-1,1+random(MaleMovement[MovementIndex])));
2660  }
2661  }
2662  // retval now holds the answer to the returning state
2663  switch (retval)
2664  {
2665  case vdisp_Mature:
2666  Setm_Mature();
2667  return tovs_Infanticide;
2668  case vdisp_Infanticide:
2669  return tovs_Infanticide;
2670  case vdisp_Die:
2671  return tovs_MDying;
2672  case vdisp_CarryOn:
2673  default:
2674  return CurrentVState;
2675  }
2676 }
const unsigned MaleMovement[4]
Definition: Vole_all.cpp:179
double g_NoFemalesMove
Definition: Vole_all.cpp:205
A class defining an animals position.
Definition: PopulationManager.h:170
unsigned m_x
Definition: PopulationManager.h:172
unsigned m_y
Definition: PopulationManager.h:173
AnimalPosition SupplyPosition()
Definition: PopulationManager.cpp:1345
void CheckTraps()
Definition: Vole_all.cpp:2800
void Setm_Mature()
Definition: vole_all.h:300
int SimH
Definition: vole_all.h:210
int SimW
Definition: vole_all.h:210
int MoveQuality(int p_x, int p_y)
Test a location for quality while moving.
Definition: Vole_all.cpp:1207
static double m_MinFVoleHabQual
Definition: vole_all.h:224
The class for female voles.
Definition: vole_all.h:571
virtual bool GetLocation(int px, int py)
Map location function.
Definition: Vole_all.cpp:3094
VoleDispersalReturns Dispersal(double p_OldQual, int p_Distance)
Male vole dispersal behaviour.
Definition: Vole_all.cpp:2689
Vole_Female * FindClosestFemale(int p_x, int p_y, int p_steps)
Definition: VolePopulationManager.cpp:2227
VoleDispersalReturns
Definition: vole_all.h:78
@ tovs_Infanticide
Definition: vole_all.h:62
@ tovs_MMaturation
Definition: vole_all.h:60

References Vole_Base::CalculateCarryingCapacity(), Vole_Base::CheckTraps(), Vole_Base::CurrentVState, Dispersal(), Vole_Population_Manager::FindClosestFemale(), Vole_JuvenileMale::FreeLocation(), g_NoFemalesMove, g_rand_uni, Vole_JuvenileMale::GetLocation(), Vole_Base::m_Age, Vole_Base::m_BornLastYear, Vole_Base::m_BreedingSeason, Vole_Base::m_DispVector, Vole_Base::m_Have_Territory, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_Mature, Vole_Base::m_MinFVoleHabQual, Vole_Base::m_OurPopulation, Vole_Base::m_TerrRange, AnimalPosition::m_x, AnimalPosition::m_y, MaleMovement, Vole_Base::MoveQuality(), random(), Vole_JuvenileMale::SetLocation(), Vole_Base::Setm_Mature(), Vole_Base::SimH, Vole_Base::SimW, Vole_Population_Manager::SupplyInOlderTerr(), TAnimal::SupplyPosition(), tovs_Infanticide, tovs_MDying, tovs_MMaturation, vdisp_CarryOn, vdisp_Die, vdisp_Infanticide, and vdisp_Mature.

Referenced by Step().

◆ st_Infanticide()

void Vole_Male::st_Infanticide ( void  )
protected

Male vole infanticide behaviour.

Will only enter here if have taken over a new area a reasonable distance from the old one and will only commit infanticide in 10% of his attempts in his minimum territory range.
Tells the population manager to send an infanticide message to all females in the territory.

2569 {
2571  // int SearchInf =(int) m_TerrRange*cfg_InfanticideRangeRelToTerRange.value();
2573  }
2574 }
static CfgFloat cfg_InfanticideProbability("INFANTI_PROBA", CFG_CUSTOM, 0.01)
@ tovm_Infanticide
Definition: VolePopulationManager.h:65
double value(void)
Definition: configurator.h:118
void SendMessage(TTypeOfVoleMessage p_message, unsigned p_x, unsigned p_y, unsigned p_range, bool p_sex, double p_Weight)
Definition: VolePopulationManager.cpp:3404

References cfg_InfanticideProbability, g_rand_uni, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_MinTerrRange, Vole_Base::m_OurPopulation, Vole_Base::m_Weight, Vole_Population_Manager::SendMessage(), tovm_Infanticide, and CfgFloat::value().

Referenced by Step().

◆ st_Maturation()

int Vole_Male::st_Maturation ( void  )
protected

Male vole maturation control.

Decide whether to become mature or not

2550 {
2552  m_OurPopulation->SupplyGrowthStartDate()) return 0;// don't mature
2553  else return 1; // matures
2554 }

References TAnimal::m_OurLandscape, Vole_Base::m_OurPopulation, Landscape::SupplyDayInYear(), and Vole_Population_Manager::SupplyGrowthStartDate().

Referenced by Step().

◆ Step()

void Vole_Male::Step ( void  )
virtual

Male vole Step.

The Step is one of the three timestep divisions. This is called repeatedly after BeginStep and before EndStep, until all voles report that they are done with Step.

Most of the behaviours are controlled by moving voles between behavioural states in Step (for other models this is also done in BeginStep and EndStep).
When a vole is done for the day it will signal this by setting m_StepDone==true. NB that a call to one behaviour may trigger a call to another behaviour on the next call to step inside the same timestep. In this way a daily cycle of activity can be undertaken.

Reimplemented from Vole_JuvenileMale.

2451 {
2452  if (m_StepDone || m_CurrentStateNo == -1) return;
2453  switch (CurrentVState)
2454  {
2455  case tovs_InitialState: //initial state
2457  break;
2458  case tovs_MMaturation: // Maturation
2459  if (st_Maturation()) Setm_Mature();
2460  CurrentVState=tovs_MEvaluateExplore; // Eval and Explore
2461  break;
2462  case tovs_MEvaluateExplore: // Eval&Explore
2464  m_StepDone = true;
2465  break;
2466  case tovs_Infanticide: // Infanticide
2467  st_Infanticide();
2469  break;
2470  case tovs_MDying:
2471  FreeLocation();
2472  m_StepDone=true;
2473  break;
2474  default:
2475  m_OurLandscape->Warn("Vole_Male::Step - unknown return error",NULL);
2476  exit(1);
2477  }
2478 }
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
TTypeOfVoleState st_Eval_n_Explore(void)
Male vole main territory assessment behaviour.
Definition: Vole_all.cpp:2584
int st_Maturation(void)
Male vole maturation control.
Definition: Vole_all.cpp:2549
void st_Infanticide(void)
Male vole infanticide behaviour.
Definition: Vole_all.cpp:2568
@ tovs_InitialState
Definition: vole_all.h:57
@ tovs_MEvaluateExplore
Definition: vole_all.h:61

References Vole_Base::CurrentVState, Vole_JuvenileMale::FreeLocation(), TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, Vole_Base::Setm_Mature(), st_Eval_n_Explore(), st_Infanticide(), st_Maturation(), tovs_Infanticide, tovs_InitialState, tovs_MDying, tovs_MEvaluateExplore, tovs_MMaturation, and Landscape::Warn().


The documentation for this class was generated from the following files: